package com.pluginsacceptor.plugin.beautify;

import java.util.List;
import java.util.Observable;

import com.pluginsacceptor.plugin.beautify.model.CellList;
import com.pluginsacceptor.utils.CommunicationUtils;

/**
 * Send font changes for selected data
 */
public class DataSender extends Observable {

    /**
     * @param cellLIst the current active cell list
     * @param cellParam the applicable param
     */
    public void sendDate(final CellList cellLIst, final String fontType, final String colorName) {

        final List<Integer> rows = cellLIst.getRows();
        final List<Integer> columns = cellLIst.getColumns();
        final int size = rows.size();
        for (int cnt = 0; cnt < size; cnt++) {
            sendDate(rows.get(cnt), columns.get(cnt), fontType, colorName);
        }
    }

    /**
     * Send date
     * @param row
     * @param column
     * @param fontType
     * @param colorName
     */
    public void sendDate(
        final int row,
        final int column,
        final String fontType,
        final String colorName
    ) {
        setChanged();
//        System.out.println("------------------------ " + CommunicationUtils.cellDisplayToString(row, column, colorName, fontType));
        notifyObservers(CommunicationUtils.cellDisplayToString(row, column, colorName, fontType));
    }

}
